package com.wanxi.app.controller.api;

import com.wanxi.app.domain.dto.SortDto;
import com.wanxi.app.domain.result.AppResult;
import com.wanxi.app.domain.vo.IndexVo;

import com.wanxi.app.service.app.AppService;
import com.wanxi.product.service.api.query.shop.SkuQueryShop;
import com.wanxi.product.service.api.query.user.SkuQuery;
import com.wanxi.product.service.api.result.CommonResult;
import com.wanxi.product.service.api.vo.user.SkuFindByIdOutVo;
import com.wanxi.shop.api.vo.FindShopAll;
import com.wanxi.shop.api.vo.SkuFindAllOutVo;
import com.wanxi.shop.api.vo.SkuFindByShopOutVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author:wgy
 * @Data：2022/1/14 16:25
 */

@RestController
@RequestMapping
public class AppApi {
    @Resource
    private AppService appService;
//    @ApiOperation(value = "搜索店铺")
//    @GetMapping("findShopNameById")
//    public CommonResult findShopNameById(Long id) {
//        CommonResult shopNameById = appService.findShopNameById(id);
//        return shopNameById;
//    }

    @ApiOperation(value = "搜索")
    @GetMapping("findProduct")
    public AppResult findProduct(SortDto sortDto) {
        AppResult<Object> product = appService.findProduct(sortDto);
        return product;
    }


    @ApiOperation(value = "获取主页数据")
    @GetMapping("findIndex")
    public AppResult<IndexVo> index( ) {
        AppResult<IndexVo> product = appService.index();
        return product;
    }

    @ApiOperation(value = "查看商品详情")
    @GetMapping("findBySkuId")
    public CommonResult<SkuFindByIdOutVo> findSkuBySkuId(Long skuId) {
        CommonResult<SkuFindByIdOutVo> product = appService.findSkuBySkuId(skuId);
        return product;
    }
    @ApiOperation(value = "根据分类查看商品")
    @GetMapping("findSkuByType")
    public com.wanxi.shop.api.result.CommonResult<List<SkuFindAllOutVo>> findSkuByType(Long typeId) {
        com.wanxi.shop.api.result.CommonResult<List<SkuFindAllOutVo>> product = appService.findSkuByType(typeId);
        return product;
    }

    @ApiOperation(value = "根据店铺查看商品")
    @GetMapping("findSkuByShopId")
    public com.wanxi.shop.api.result.CommonResult<List<SkuFindByShopOutVo>> findSkuByShopId(Long shopId){
        com.wanxi.shop.api.result.CommonResult<List<SkuFindByShopOutVo>> product = appService.findSkuByShopId(shopId);
        return product;
    }

    @ApiOperation(value = "查找所有店铺")
    @GetMapping("findShopAll")
    public com.wanxi.shop.api.result.CommonResult<List<FindShopAll>> findShopAll(Long shopId){
        com.wanxi.shop.api.result.CommonResult<List<FindShopAll>> product = appService.findShopAll(shopId);
        return product;
    }

}
